﻿@using DotNet.Framework.Admin.Entity.EDNFramework_Repairs;
@model List<Entity_Order_History>
@{
    ViewBag.Title = "维修单详情";
    Entity_Order oInfo = ViewBag.OrderInfo as Entity_Order;
}

<div class="bs-example bs-example-standalone">
    <div role="alert" class="alert alert-info alert-dismissible fade in">
        订单号：<strong>@ViewBag.OrderId</strong> 的处理进度
    </div>
</div>
<div class="list-group">
    <ul class="list-group">
        @foreach (var order in Model)
        {
            <li class="list-group-item"><em>@order.CreateTime2.ToString("MM/dd HH:mm")</em> @OnlineRepairs.Web.Models.OrderModel.GetOrderStatusString(order.Status) @if (order.Status == 2)
                                                                                                                                                                    {
                <text> - @order.NickName (@order.Phone)</text>
                                                                                                                                                                    }</li>    
        }
    </ul>
</div>
@if (oInfo.Statu == 3)
{
    <div class="bs-example bs-example-standalone">
        <div role="alert" class="alert alert-info alert-dismissible fade in">
            @using (Ajax.BeginForm("SetOrderCompleted", "home", null, new AjaxOptions() { OnFailure = "OnFailure", OnSuccess = "OnSuccess", HttpMethod = "POST", Confirm = "确认完成后订单将会自动关闭，是否继续？" }))
            {

                <h4>提示!</h4>
                <p>订单 已经处理完成，请确认。</p>
                <p>
                    <input type="hidden" name="id" value="@oInfo.ID" />
                    <textarea class="form-control" rows="3" name="remark" placeholder="评价"></textarea>
                </p>
                <p>
                    <input class="btn btn-default" type="submit" value="确认完成" />
                </p>
                
            }
        </div>
    </div>
}
@section scripts{
    <script type="text/javascript">
        function OnSuccess(data) {
            if (data) {
                if (data.status == 1) {
                    location.reload();
                }
                else {
                    alert(data.message);
                }
            }
        }
    </script>
}